@extends("main")
@section("title")
	Đăng ký
@endsection
@section("content")
	<style>
		label.error{
			color: red;
		}

	</style>
	<form action="{{Asset('register')}}" method="post" style="width:600px; margin:auto" id="form-register" >
		<h2>Đăng Ký</h2>
		<input type="text" name="username" placeholder="Username" id="username" class="form-control" style="margin-bottom:10px;">		
		<input type="password" name="password" placeholder="Passwords" id="password" class="form-control" style="margin-bottom:10px;">	
		<input type="password" name="password_confirmation" placeholder="RePasswords" id="password_confirmation" class="form-control" style="margin-bottom:10px;">		
		<input type="text" name="email" id="email" placeholder="Email" class="form-control" style="margin-bottom:10px;">		
		
		<label for="">Ghi Chú</label>
		{{ HTML::script('plugins/ckeditor/ckeditor.js') }}
        <textarea name="txtDescription" id="txtDescription"></textarea>
        <script language="javascript" type="text/javascript">
            CKEDITOR.replace('txtDescription',
            {
                filebrowserBrowseUrl: 'plugins/ckeditor/ckfinder/ckfinder.html&LangCode=vi',
                filebrowserImageBrowseUrl: 'plugins/ckeditor/ckfinder/ckfinder.html?type=Images',
                filebrowserFlashBrowseUrl: 'plugins/ckeditor/ckfinder/ckfinder.html?type=Flash',
                // width: 500,
                height: 500,
                toolbarStartupExpanded: false 
            });
        </script>

		<button class="btn btn-lg btn-primary btn-block">Đăng Ký</button>
	</form>

	<script>
		$("#form-register").validate({
			rules:{
				username:{
					required:true,
					minlength:3,
					remote:{
						url:"{{Asset('check/check-username')}}",
						type:"POST"
					}
				},
				password:{
					required:true,
					minlength:3
				},
				password_confirmation:{
					equalTo:"#password"
				},
				email:{
					required:true,
					email:true,
					remote:{
						url:"{{Asset('check/check-email')}}",
						type:"POST"
					}
				}
			},
			messages:{
				username:{
					required:"Vui lòng nhập username",
					minlength:"Tối thiểu 3 ký tự",
					remote:"username đã tồn tại"
				}
			}
		})
	</script>
@endsection
